<template>
 <!-- 底部部分 -->
  <footer class="footer">
      <span class="todo-count">剩余<strong>{{shengyu}}</strong></span>
      <ul class="filters" @click="$emit('changeType',type)">
        <li>
          <a :class="{selected:type==='all'}" href="#/"
          @click.prevent="type='all'"
          >全部</a>
        </li>
        <li>
          <a href="#/"
          @click.prevent="type='active'"
          :class="{selected:type==='acitve'}"
          >进行中</a>
        </li>
        <li>
          <a href="#/"
          @click.prevent="type='completed'"
          :class="{selected:type==='completed'}"
          >已完成</a>
        </li>
      </ul>
      <button v-show="showClear"  class="clear-completed" @click="Aclear">清除已完成</button>
    </footer>
</template>

<script>
export default {
  name: 'TodoFooter',
  props:{
    list:{
      type:Array,
      required:true
    }
  },
  data() {
    return {
      type:''
    };
  },
   methods:{
    
     Aclear() {
      this.$emit('Hclear')
     }
  },
  computed:{
    shengyu(){
      return this.list.length
    },
    showClear(){
      return this.list.some(item => item.isDone)
    },
    
  },

};
</script>

<style lang="scss" scoped>

</style>